package com.leigq.dynamic.task.controller;


import com.leigq.dynamic.task.task.DynamicTask;
import com.leigq.dynamic.task.web.DynamicTaskSupport;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * The type Test controller.
 *
 * @author leiguoqing
 */
@RequiredArgsConstructor
@RestController
@RequestMapping("/test")
public class TestController {

    private final DynamicTaskSupport dynamicTaskSupport;


    /**
     * 动态修改cron表达式
     *
     * @param cron the cron
     * @return the string
     */
    @GetMapping("/cron/update")
    public String test(String cron) {
        dynamicTaskSupport.update(DynamicTask.TYPE, cron);
        return "ok";
    }
}
